package main

import (
	"container/list"
	"fmt"
)

func main() {
	stack := list.New()
	stack.PushBack(1)
	stack.PushBack(2)
	stack.PushBack(3)
	stack.PushBack(4)
	fmt.Println(stack.Front())
	fmt.Println(stack.Back())
	fmt.Println(stack.Len())

	for r := stack.Front(); r != nil; r = r.Next() {
		fmt.Println(r.Value)
	}

	stack.Remove(stack.Back())
	fmt.Println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
	for r := stack.Front(); r != nil; r = r.Next() {
		fmt.Println(r.Value)
	}
}
